using Godot;
using System;
using DelaunatorSharp;

public partial class DelaunatorNode : Node
{
	// Called when the node enters the scene tree for the first time.
	public Delaunator delaunator;
	public int[] 三角序号;
	public void 计算三角(Godot.Collections.Array<Vector2> 坐标集)
	{
		var count=坐标集.Count;
		IPoint[] points=new IPoint[count];
		for(int i=0;i<count;++i)
		{
			points[i]=转成C坐标(坐标集[i]);
		}
		delaunator=new Delaunator(points);
		三角序号=delaunator.Triangles;
	}
	// Called every frame. 'delta' is the elapsed time since the previous frame.
	private IPoint 转成C坐标(Vector2 坐标)
	{
		IPoint point=new Point();
		point.X=坐标.X;
		point.Y=坐标.Y;
		return point;
	}
	private Vector2 转成G坐标(IPoint 坐标)
	{
		Vector2 vector2=new();
		vector2.X=(float)坐标.X;
		vector2.Y=(float)坐标.Y;
		return vector2;
	}
}
